<?php
namespace gnomephp;

/**
 * Information for the framework. Constists of constants that holds information about the framework version and so on.
 * 
 * @author peec
 *
 */
class Gnomephp{

	/**
	 * Returns the name of the framework.
	 * @var string
	 */
	const NAME = 'GnomePHP';
	
	
	/**
	 * The version of the release.
	 * @var float
	 */
	const VERSION = 1.0;
	/**
	 * If this is a BETA release, this will be true.
	 * @var bool
	 */
	const BETA = false;
	
	/**
	 * If this is a ALPHA release, this will be true.
	 * @var bool
	 */
	const ALPHA = true;
	
	
	/**
	 * Array of main authors / developers of GnomePHP.
	 * @var array
	 */
	static public $AUTHORS = array(
		'peec | Petter Kjelkenes <kjelkenes@gmail.com>'
	);
	
	
	/**
	 * Returns array of authors / developers.
	 * @return array Array of authors.
	 */
	static public function getAuthors(){
		return self::$AUTHORS;
	}
	
	/**
	 * Returns true if this release is a stable release.
	 * 
	 * @return bool Returns true if this is a stable release.
	 */
	static public function isStableRelease(){
		return (!self::BETA && !self::ALPHA);
	}
	
	
	/**
	 * Gets the fully qualified version name of GnomePHP.
	 * @return string The version including alpha / beta flag if not in stable release mode.
	 */
	static public function getVersion(){
		$str = self::VERSION;
		if (self::ALPHA)$str .= 'a';
		elseif(self::BETA)$str .= 'b';
		return $str;
	}
	
	
	/**
	 * Gets a resource from the framework directory ( not application directory )
	 * If it does exist in the application directory this resource will be added.
	 * @param string $file The relative path to the file.
	 */
	static public function getResourceOverride($file){
		$fw  =  GNOME_FW_PATH . DIRECTORY_SEPARATOR . 'res' . DIRECTORY_SEPARATOR .  $file;
		$app = GNOME_APP_PATH . DIRECTORY_SEPARATOR . $file;
		if (file_exists($app)){
			return $app;
		}else{
			return $fw;
		}
	}
	
	
}